<?php
require_once("./bm_header.php");
$TeamBool = 0;
$is_admin = isset($_SESSION['administrator']) || isset($_SESSION[$BM_ADMIN]);
if (isset($_GET['cid']))
{
	$cid=intval($_GET['cid']);
	$view_cid=$cid;
	require_once("./judgecid.php");//判断查看权限、比赛id合法性等等非正常访问
	require_once("template/".$BM_TEMPLATE."/contest_enter.php");
}
/**********以下是没有GET到cid的时候，列出比赛列表*****************/
else
{
	$sql="SELECT * FROM `cr_contest` WHERE `contest_active`='Y' ORDER BY `contest_id` DESC";
	$result=mysql_query($sql);
	$c_sum = 0;
	$now=time();
	while ($row=mysql_fetch_object($result))
	{
		
		$contest_id[$c_sum]=$row->contest_id;
		$contest_title[$c_sum]=$row->contest_title;
		$contest_0_start[$c_sum]=strtotime($row->contest_0_start);
		$contest_0_end[$c_sum]=strtotime($row->contest_0_end);
		$contest_0_view_start[$c_sum]=($row->contest_0_start);
		$contest_0_view_end[$c_sum]=($row->contest_0_end);
		$contest_0_active[$c_sum]=$row->contest_0_active;
		$contest_1_start[$c_sum]=strtotime($row->contest_1_start);
		$contest_1_end[$c_sum]=strtotime($row->contest_1_end);
		$contest_1_view_start[$c_sum]=($row->contest_1_start);
		$contest_1_view_end[$c_sum]=($row->contest_1_end);
		$contest_1_active[$c_sum]=$row->contest_1_active;
		$c_sum ++;
	}
	mysql_free_result($result);
	require_once("template/".$BM_TEMPLATE."/contest.php");
}

require_once("template/".$BM_TEMPLATE."/bm_footer.php");
?>
